// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Author: wsfuyibing <682805@qq.com>
// Date: 2024-07-23

package src

// Result
// is a standard response operations.
type Result interface {
	IsHtml() bool
	IsString() bool

	// String
	// convert result as JSON string.
	String() string

	// With
	// generate response as normal with any on data field.
	With(data any) Result

	// WithCodeError
	// generate response as error with specified code and message.
	WithCodeError(code int, message string) Result

	// WithEmpty
	// generate response a simple struct without data field.
	WithEmpty() Result

	// WithError
	// generate response as error struct.
	WithError(err error) Result

	// WithHtml
	// generate response as error struct.
	WithHtml(body []byte) Result

	// WithList
	// generate response as listing on data field.
	WithList(items any) Result

	// WithPaging
	// generate response as paging with a paginator fields on data field.
	WithPaging(items any, total int64, page, size int) Result

	// WithString
	// generate response as string result.
	WithString(str string) Result
}
